/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package search;

import java.util.Comparator;
import java.util.PriorityQueue;

/**
 *
 * @author user
 */
public class BestFirstSearch implements NodeQueue{

    PriorityQueue<Node> queue = new PriorityQueue<Node>(100, new Comparator<Node>() {

        /**
         * return positive if first is greater then second.
         */
        @Override
        public int compare(Node o1, Node o2) {
            return o1.h - o2.h;
        }
    });

    public Node poll() {
        return queue.poll();
    }

    public void add(Node n) {
        queue.add(n);
    }

    public boolean isEmpty() {
        return queue.isEmpty();
    }

    public void clear() {
        queue.clear();
    }

}
